<template>
    <h1>分页</h1>
    <el-table :data="tableData" style="width: 100%">
        <el-table-column prop="account" label="用户名" />
        <el-table-column prop="createTime" label="注册时间" />
        <el-table-column prop="level" label="等级" />
    </el-table>
    <el-pagination
      v-model:current-page="currentPage4"
      v-model:page-size="pageSize4"
      :page-sizes="[5, 20]"
      :small="small"
      :disabled="disabled"
      :background="background"
      layout="->,total, sizes, prev, pager, next, jumper"
      :total=total
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
    />
</template>

<script>
const data = Array.from(Array(114), (v, i) => {
    return {
        account: "uaa" + (i + 1),
        createTime: new Date(Date.now() + Math.ceil(Math.random() * 1000)),
        level: Math.ceil(Math.random() * 10)
    }
})

export default{
    data(){
        return{
            tableData:[],
            currentPage4:1,
            pageSize4:5,
            total:0,
            pageSizes:[5,10]
        }
    },
    methods:{
        getData(page, pageSize) {
            this.tableData = data.slice((page - 1) * pageSize, page * pageSize);
            this.total = data.length
        }
    }
}
</script>